package com.xx.job.controller.system;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xx.job.common.PageResult;
import com.xx.job.common.Result;
import com.xx.job.controller.dto.PageDTO;
import com.xx.job.entity.system.SysContent;
import com.xx.job.service.system.SysContentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;
import com.xx.job.controller.base.BaseController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liangcy
 * @since 2021-01-14
 */
@RestController
@RequestMapping("/api/v1")
public class SysContentController extends BaseController {

    @Autowired
    private SysContentService sysContentService;
    
    @RequestMapping("/syscontentList")
    public Result operloglist(PageDTO pageDTO, SysContent sysContent){
        IPage<SysContent> sysContentIPage;
        sysContentIPage = sysContentService.selectPage(pageDTO, sysContent);
        return Result.success(new PageResult(sysContentIPage));
    }

    @PostMapping("/syscontent")
    public Result addContent(@RequestBody SysContent sysContent){
        return Result.success(sysContentService.add(sysContent));
    }

    @DeleteMapping("/syscontent/{id}")
    public Result deleteContent(@PathVariable Long id){
        return Result.success(sysContentService.delete(id));
    }

    @PutMapping("/syscontent")
    public Result updateContent(@RequestBody SysContent sysContent){
        return Result.success(sysContentService.update(sysContent));
    }

    @GetMapping("/syscontent/{id}")
    public Result selectContent(@PathVariable Long id){
        return Result.success(sysContentService.select(id));
    }
    
}

